<script type="text/javascript" src="../includes/js/validation.js"></script>
<script type="text/javascript">
	$(document).ready(function() {

		//add announcement dialog.
		$('#addDlg').dialog({
			autoOpen: false,
			modal: true,
			closeOnEscape: true,
			height: "auto",
			width: 375,
			show: 'fade',
			resizable: false,
			draggable: false,
			open: function(event, ui) {
				//focus on form.
				$("#announcement").focus();
			},
			close: function(event, ui) {
				//clear form.
				$("#announcement").val("");
			}
		});


		//deletes the selected announcement
		$('#deleteAnnouncement').live('click', function() {

			var announceID = $(this).attr("title");

			//setup confirmation message.
			$('#confirmMsg').html(lang.cfmDel);

			//setup buttons
			var btnConf = {};
			 btnConf[lang.Yes] = function() {
				//call .ajax to call server.
				$.ajax({
					method: "get", url: "acpsettings.php?section=remove_announcement", data: "id=" + announceID,
					success: function(){
						setTimeout("window.location.reload()", 1000); //reload after 2 seconds.
						
						//close dialog.
						$("#confirmDlg").dialog('close');
					}
				}); //END $.ajax(
			};
			btnConf[lang.No] = function() {
				$(this).dialog('close');
			};

			//add buttons to dialog.
			$("#confirmDlg").dialog({
			  title: lang.confDel,
			  buttons : btnConf,
			  open: function(event, ui) {
				  $(".ui-dialog-titlebar-close", ui.dialog).hide();
			  }
			});

			//show dialog.
			$("#confirmDlg").dialog('open');

		}); //END deleteAttachment

		//Add Announcement Dialog.
		$('#addAnnouncement').live('click', function() {
			$('#addDlg').dialog('open');
		});

	});
</script>


<div id="addDlg" style="display:none" title="{LANG-ADDANNOUNCEMENT}">
<form method="post" action="acpsettings.php?section=add_announcement">

<p>
{LANG-ANNOUNCEMENT}<br />
<input type="text" name="announcement" class="text" size="30" id="announcement" tabindex="1" maxlength="255" onblur="validateNotNull('announcement', 'announcementerr');" />
<div id="announcementerr"></div>
</p>

<p>
<input type="submit" value="{LANG-ADDANNOUNCEMENT}" class="submit" />
</p>
</form>
</div>


<br /><div class="ui-widget-content"><a href="../index.php">{TITLE}</a> &#187; <a href="index.php">{LANG-TITLE}</a> &#187; {LANG-ANNOUNCEMENTSETTINGS}</div><br />

<form method="post" action="acpsettings.php?section=save_announcements">
<table border="0" class="table" cellspacing="1" cellpadding="1">
<tr>
<td colspan="2" align="center" class="ui-widget-header">{LANG-ANNOUNCEMENTSETTINGS}</td>
</tr><tr>
<td class="ui-widget-content" width="50%">{LANG-ANNOUNCEMENTSTATUS}</td>
<td class="ui-widget-content" width="50%">
<!-- START announcementOn -->
<input type="radio" name="announce_stat" value="1" checked=checked />{LANG-ON} <input type="radio" name="announce_stat" value="0" />{LANG-OFF}
<!-- END announcementOn -->

<!-- START announcementOff -->
<input type="radio" name="announce_stat" value="1" />{LANG-ON} <input type="radio" name="announce_stat" value="0" checked=checked />{LANG-OFF}
<!-- END announcementOff -->
</td>
</tr><tr>
<td colspan="2" align="center" class="ui-widget-header"><input type="submit" Value="{LANG-SAVESETTINGS}" class="submit"></td>
</tr>
</table>
</form><br />

<input type="button" value="{LANG-ADDANNOUNCEMENT}" id="addAnnouncement" title="{ID}" class="submit" /><br /><br />
<div class="ui-widget-content">{LANG-ANNOUNCEMENT}</div>